<?php

namespace app\admin\validate;

use think\Validate;

class FileValidate extends Validate
{
    protected $message = [
        'id.require' => 'ID必须填写',
        'id.integer' => 'ID必须为整数',
        'ids.require' => 'ID列表必须填写',
        'ids.array' => 'ID列表必须为数组',
        'name.max' => '文件名最多不能超过255个字符',
        'original_name.max' => '原始文件名最多不能超过255个字符',
        'path.max' => '文件路径最多不能超过500个字符',
        'url.max' => '文件URL最多不能超过500个字符',
        'extension.max' => '文件扩展名最多不能超过10个字符',
        'mime_type.max' => 'MIME类型最多不能超过100个字符',
        'size.integer' => '文件大小必须为整数',
        'md5.max' => 'MD5值最多不能超过32个字符',
        'status.in' => '状态值错误',
    ];
    protected $group = [
        'index' => [
            'page' => 'integer|egt:1',
            'limit' => 'integer|between:1,100',
            'name' => 'max:255',
            'original_name' => 'max:255',
            'status' => 'integer|in:0,1',
        ],
        'info' => [
            'id' => 'require|integer',
        ],
        'delete' => [
            'id' => 'require|integer',
        ],
        'batchDelete' => [
            'ids' => 'require|array',
        ],
    ];
}